#!/usr/bin/env python
PACKAGE = "ros_plane"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

# trim
trim = gen.add_group("Trim")
trim.add("TRIM_E", double_t, 0, "Elevator trim", 0, -1, 1)
trim.add("TRIM_A", double_t, 0, "Aileron trim", 0, -1, 1)
trim.add("TRIM_R", double_t, 0, "Rudder trim", 0, -1, 1)
trim.add("TRIM_T", double_t, 0, "Throttle trim", 0.6, 0, 1)

# course hold
course = gen.add_group("Course")
course.add("COURSE_KP", double_t, 0, "Course proportional gain", 0.7329, 0, 5)
course.add("COURSE_KD", double_t, 0, "Course derivative gain", 0, -5, 0)
course.add("COURSE_KI", double_t, 0, "Course integral gain", 0.0, 0, 5)

# roll hold
roll = gen.add_group("Roll")
roll.add("ROLL_KP", double_t, 0, "Roll proportional gain", 1.2855, -10, 10)
roll.add("ROLL_KD", double_t, 0, "Roll derivative gain", -0.1, -10, 10)
roll.add("ROLL_KI", double_t, 0, "Roll integral gain", 0, -10, 10)

# pitch hold
pitch = gen.add_group("Pitch")
pitch.add("PITCH_KP", double_t, 0, "Pitch proportional gain", 1.0, -10, 10)
pitch.add("PITCH_KD", double_t, 0, "Pitch derivative gain", -0.17, -10, 10)
pitch.add("PITCH_KI", double_t, 0, "Pitch integral gain", 0, -10, 10)
pitch.add("PITCH_FF", double_t, 0, "Pitch feed forward value", 0, -10, 10)

# airspeed with pitch hold
as_pitch = gen.add_group("Airspeed with Pitch")
as_pitch.add("AS_PITCH_KP", double_t, 0, "Airspeed with pitch proportional gain", -0.0713, -10, 10)
as_pitch.add("AS_PITCH_KD", double_t, 0, "Airspeed with pitch derivative gain", -0.0635, -10, 10)
as_pitch.add("AS_PITCH_KI", double_t, 0, "Airspeed with pitch integral gain", 0, -10, 10)

# airspeed with throttle hold
as_thr = gen.add_group("Airspeed with Throttle")
as_thr.add("AS_THR_KP", double_t, 0, "Airspeed with throttle proportional gain", 3.2, -10, 10)
as_thr.add("AS_THR_KD", double_t, 0, "Airspeed with throttle derivative gain", 0, -10, 10)
as_thr.add("AS_THR_KI", double_t, 0, "Airspeed with throttle integral gain", 1.0, -10, 10)

# altitude hold
alt = gen.add_group("Altitude")
alt.add("ALT_KP", double_t, 0, "Altitude proportional gain", 0.045, -10, 10)
alt.add("ALT_KD", double_t, 0, "Altitude derivative gain", 0, -10, 10)
alt.add("ALT_KI", double_t, 0, "Altitude integral gain", 0.01, -10, 10)

# side-slip hold
sideslip = gen.add_group("Side Slip")
sideslip.add("BETA_KP", double_t, 0, "Side slip proportional gain", -0.1164, -10, 10)
sideslip.add("BETA_KD", double_t, 0, "Side slip derivative gain", 0, -10, 10)
sideslip.add("BETA_KI", double_t, 0, "Side slip integral gain", -0.0037111, -10, 10)

exit(gen.generate(PACKAGE, "ros_plane", "Controller"))
